package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethed;

import java.lang.reflect.Method;

public class ReflectDemo12 {
    public static void main(String[] args) throws Exception {
        //需求:获取Person类中sayHello方法上@AutoRunMethod注解中的参数值
        Class cls = Class.forName("reflect.Person");
        Method method = cls.getMethod("sayHello");
        if(method.isAnnotationPresent(AutoRunMethed.class)){
            AutoRunMethed arm = method.getAnnotation(AutoRunMethed.class);
            int value = arm.value();
            System.out.println("参数值为:"+value);
        }
    }
}
